<template>
  <div class="app">
    <h1 ref="title">{{ title }}</h1>
    <button @click="changeTitle" ref="btn">ref按钮</button>
    <get-element ref="getelement"></get-element>
  </div>
</template>

<script>
import GetElement from './GetElement.vue'
export default {
  components: { GetElement },

  data() {
    return {
      title: "I am Title"
    }
  },
  methods: {
    changeTitle() {
      this.title = "I am changed Title"
      console.log(this.$refs.title)
      console.log(this.$refs.getelement)
      console.log(this.$refs.getelement.$el)  //获取的组件实例，通过$el获取组件中的元素
    }
  }
}
</script>

<style>

</style>